import json
import random
import re

import requests
# from fontTools.ttLib import TTFont
#
# font = TTFont('10ce1aee.woff')
# font1 = TTFont('./63a69017.woff')
# font2 = TTFont('./e54fa5e2.woff')
# font_names = font.getGlyphOrder()
# font_names1 = font1.getGlyphOrder()
# font_names2 = font2.getGlyphOrder()
# print("unif893" in font_names)
# print(font_names)
# # print("unif893" in font_names1)
# # print("unif893" in font_names2)
# texts = ['','','1','2','3','4','5','6','7','8','9','0']
#
# font_name = {}
# # 将字体名字和它们所对应的乱码构成一个字典
#
# for index,value in enumerate(texts):
#     a = font_names[index].replace('uni', '&#x').lower() + ";"
#     font_name[a] = value
# print(font_name)
#
# a = [r'<b>1<svgmtsi class="shopNum">\uf0b2</svgmtsi><svgmtsi class="shopNum">\ue9c3</svgmtsi></b>']
# shop_comment = re.sub('([1])', r'<svgmtsi class="shopNum">\\uec2f', a[0])
# print(shop_comment)
# unum_list = re.findall('<svgmtsi class="shopNum">(.*?)<', shop_comment)
# print(unum_list)
# for unum in unum_list:
#     new_unum = unum.replace("\\u", "&#x") + ";"
#     print(new_unum)
#     num = font_name.get("new_unum")
#     print(num)

# res = requests.get("http://s3plus.meituan.net/v1/mss_73a511b8f91f43d0bdae92584ea6330b/font/10ce1aee.woff").content
# with open("f.woff", "wb") as f:
#     f.write(res)
# ff = TTFont("f.woff")
# print(ff.getGlyphOrder())

# url = "http://www.dianping.com/shenzhen/ch10/g110"
# headers = {
#     "USER_AGENT":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36",
# }

# html = requests.get(url, headers=headers, cookies=cookies).text
# print(html)
# #requests获得html
#
#
# #获得加密映射关系
#
# for key in font_name:
#     if key in html:
#         html = html.replace(key, str(font_name[key]))

# print(html)

# from fake_useragent import UserAgent
#
# ua = UserAgent()
# print(ua)
# print(ua.random)


# from requests.utils import dict_from_cookiejar

# response = requests.get('https://www.baidu.com')
# resp = requests.Request("GET", 'https://www.baidu.com')
# # 将cookie转为字典
# # cookies = dict_from_cookiejar(response.cookies)
# # print(cookies)
#
# print(type(response))  #<class 'requests.models.Response'>
# print(type(resp))  #<class 'requests.models.Request'>


import time

# a = [{
#     "value": [{
#         "name": "阿坝",
#         "url": "aba"
#     }, {
#         "name": "阿克苏",
#         "url": "akesu"
#     }, {
#         "name": "阿拉尔",
#         "url": "alaer"
#     }, {
#         "name": "阿拉善盟",
#         "url": "alashan"
#     }, {
#         "name": "阿勒泰",
#         "url": "aletai"
#     }, {
#         "name": "阿里",
#         "url": "ali"
#     }, {
#         "name": "安康",
#         "url": "ankang"
#     }, {
#         "name": "安庆",
#         "url": "anqing"
#     }]},
#     {"value": [{
#         "name": "巴彦淖尔",
#         "url": "bayannaoer"
#     }, {
#         "name": "巴音郭楞",
#         "url": "bayinguoleng"
#     }, {
#         "name": "巴中",
#         "url": "bazhong"
#     }, {
#         "name": "白城",
#         "url": "baicheng"
#     }, {
#         "name": "白沙",
#         "url": "baisha"
#     }, {
#         "name": "白山",
#         "url": "baishan"
#     }, {
#         "name": "白银",
#         "url": "baiyin"
#     }, {
#         "name": "百色",
#         "url": "baise"
#     }, {
#         "name": "蚌埠",
#         "url": "bangbu"
#     }, {
#         "name": "包头",
#         "url": "baotou"
#     }]}
# ]
#
# for i in a:
#     item = {}
#     city_data = i["value"]
#     for city in city_data:
#
#         item["name"] = city["name"]
#         item["url"] = city["url"]
#         print(item)
# data = {"b":{"bizVersion":"17","cityUrl":"shenzhen","cityName":"深圳","fromDate":"2020-10-22","toDate":"2020-10-23","q":"","qFrom":3,"start":0,"num":20,"minPrice":0,"maxPrice":-1,"level":"","sort":0,"cityType":1,"fromForLog":1,"uuid":"","userName":"","userId":"","searchType":0,"hourlyRoom":False,"locationAreaFilter":[],"comprehensiveFilter":[],"vtoken":"pclist-v1-89412dc54851e3f68e034ceba77df341","channelId":1}}
# payloadHeader = {
#     'Content-Type': 'application/json',
# }
# r =requests.post("http://hotel.qunar.com/napi/list", json=json.dumps(data), headers=payloadHeader)
# print(r.content.decode())


# v = [{"type": "a", "datas": [{"a": 1}, {"a": 6}]},
#      {"type": "b", "datas": [{"a": 2}, {"a": 7}]},
#      {"type": "c", "datas": [{"a": 3}, {"a": 8}]},
#      {"type": "d", "datas": [{"a": 4}, {"a": 9}]}]
#
# t =[]
# d = {}
# s = []
# for i in v:
#     # print(i)
#     s.append(i["type"])
#     a = []
#     for j in i["datas"]:
#         a.append(j["a"])
#
#     # print(a)
#     t.append(a)
#
# print(dict(zip(s, t)))

# for i in range(len(t)):
#
#     d[v[i]["type"]] = t[i]
# d.update(l=2)
# print(d)
# print(t)
# total_page = re.findall('"tcount":(.*?),', '"tcount":14229,"fixTab"')[0]
# print(type(total_page))


# r = requests.get("https://www.tripadvisor.cn/Tourism-g297411-Guangdong-Vacations.html").content.decode("utf-8")
# print(r)
# a = ["携程旅行网","携程旅行网","Agoda.com","缤客 Booking.com"]
# b = [1,2,3,4]
# print(dict(zip(a,b)))

# from selenium import webdriver
# from selenium.webdriver.support.ui import WebDriverWait
# from selenium.webdriver.common.by import By
# from selenium.webdriver.support import expected_conditions as EC
# # Headless模式，无界面
# chrome_options = webdriver.ChromeOptions()
#
# # chrome_options.add_argument("--headless")
# # chrome_options.add_argument("user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1")
# driver = webdriver.Chrome(options=chrome_options)
# driver.set_window_size(450, 1080)
# driver.get("https://www.tripadvisor.cn/Hotel_Review-g297415-d1141607-Reviews-Futian_Shangri_La-Shenzhen_Guangdong.html")
# # driver.implicitly_wait(10)
# # wait = WebDriverWait(driver, 10)
# # element = driver.find_element_by_class_name("fullwidth").is_displayed()
# element = driver.find_element_by_class_name("fullwidth")
# # element = wait.until(EC.element_to_be_clickable((By.CLASS_NAME,"ui_button secondary fullwidth")))
# print(element)
# # import time
# # time.sleep(1)
# element.click()
# # print(111)
# # driver.close()
a= "找到7,961家酒店"
b=re.findall("\d+", a)
print("".join(b))


